<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>상품등록</title>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.1.0.js"></script>
<script type="text/javascript">

	$(document).ready(function() {
		$("#regis").click(function() {

			var productName = $(":text[name=productName]").val();
			var productPrice = $(":text[name=productPrice]").val();
			var productMaker= $(":text[name=productMaker]").val();
			var productInfo= $(":text[name=productInfo]").val();
			var productTitle=$(":text[name=productTitle]").val();
			var sellerId=$(":text[name=sellerId]").val();
			if (productName == "") {
				alert("상품명을 입력하세요!");
				return false;
			}
			else if (productPrice == "") {
				alert("가격을 입력하세요!");
				return false;
			}
			else if (isNaN($("#productPrice").val())){
				alert("가격을 숫자로 입력하세요!");
				return false;
			}
			
			else if (productMaker == "") {
				alert("제조사를 입력하세요!");
				return false;
			}
			else if (productInfo == "") {
				alert("상품정보를 등록하세요!");
				return false;
			}
			else if (productTitle == "") {
				alert("상품 제목을 입력하세요!");
				return false;
			}
			else if (sellerId == "") {
				alert("판매자 id를  입력하세요!");
				return false;
			}
			
		
			alert("상품 등록이 되었습니다");
			$("#registerProduct").submit();
	
		});
	});
</script>
</head>
<body>
<center>상품등록</center>
	<hr>상품 카테고리 : ${requestScope.productCategory }
<form method="post" action="product.do" id="registerProduct"  enctype="multipart/form-data"  >
<!-- enctype="multipart/form-data" -->

<table border="1" cellpadding="5">
<tr><td><center>상품명</center></td><td> <input type="text" name="productName"></td><tr>
<tr><td><center>가격</center> </td><td>  <input type="text" name="productPrice" id="productPrice"></td><tr>
<tr><td><center>제조사</center> </td><td>  <input type="text" name="productMaker"></td><tr>
<tr><td><center>상품정보</center> </td><td><textarea  name="productInfo"></textarea></td><tr>
<tr><td><center>타이틀</center> </td><td><input type="text" name="productTitle"></td><tr>
<tr><td><center>판매자 ID</center></td><td><input type="text" name="sellerId" value="${sessionScope.svo.sellerId }" readonly="readonly"></td><tr>

<input type="hidden" name="productCategory"  value="${requestScope.productCategory }">
<!--  이미지 등록 버튼  -->
<tr><td colspan="2"><center><input type="file" name="uploadFile" ></center>
<center><input type="button" id="regis" value="상품등록"></center></td><tr>

	</table>	

	</form>

</body>
</html>